local skel = fk.CreateSkill {
  name = "lb__zuolun",
}

Fk:loadTranslationTable {
  ["lb__zuolun"] = "左轮",
  [":lb__zuolun"] = "每回合限一次，当你使用【杀】时，你可以弃置至多5张【杀】令伤害加X，若如此做，此【杀】被抵消后，你摸X+1张牌（X为弃置【杀】数）。",

  ["#lb__zuolun_out"] = "左轮",
  ["#lb__zuolun"] = "左轮：你可以弃置至多5张【杀】",

  ["$lb__zuolun1"] = "上膛。",
  ["$lb__zuolun2"] = "再跑快点！",
}

skel:addEffect(fk.CardUsing, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and
        data.card.trueName == "slash" and player:usedSkillTimes(skel.name) == 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    if not table.find(player:getCardIds("h"), function(id)
          return Fk:getCardById(id).trueName == "slash"
        end) then
      return
    end
    local n = #room:askToDiscard(player, {
      min_num = 1,
      max_num = 5,
      include_equip = false,
      skill_name = skel.name,
      cancelable = true,
      pattern = "slash",
      prompt = "#lb__zuolun"
    })
    event:setCostData(self, { n = n })
    return n > 0
  end,
  on_use = function(self, event, target, player, data)
    local n = event:getCostData(self).n
    data.extra_data = data.extra_data or {}
    data.extra_data.lb__zuolun = n + 1
    data.additionalDamage = (data.additionalDamage or 0) + n
  end,
})

skel:addEffect(fk.CardEffectCancelledOut, {
  is_delay_effect = true,
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill("lb__zuolun") and data.extra_data and data.extra_data.lb__zuolun
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(data.extra_data.lb__zuolun, "lb__zuolun")
  end,
})

return skel
